<HTML>
	<TITLE>Workflow.NET<%#actionname%>		-<%#propertyname%></TITLE>
	<STYLE>
	<%#stylesheet%>
	.N-ListBGCOLORCOL1
		{
		    BACKGROUND-COLOR: #e9e9e9
		}
		.N-ListBGCOLORCOL2
		{
		    BACKGROUND-COLOR: #f5f4f4
 	}
	tdwork {
		font-family: Verdana, Arial;
		font-size: 10px;
	}
	.titlework {
		font-family: Verdana, Arial;
		font-size: 11px;
		font-weight: bold;
	}
	.input-buttonswork {
		font-family: Verdana, Arial;
		font-size: 11px;
		border: 1px inset #447392;
		color: #2A3B66;
		height: 21px;
		width:auto;
		background-image:url(<%#VirtualDirectory%>/images/button-bg.gif);

	}
	.style1 {color: #FFFFFF}
    </STYLE>
	<BODY  MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0" onload="init();checktoselect();" scroll="no">
		<FORM name=wf_theform method="post" ID="Form1">

			<TABLE align="center" border="0" cellspacing="1" cellpadding="2" width="100%" bgcolor="#447392" ID="Table1">

				 <tr bgcolor="#C4D2FB">
				    <td height="23" background="<%#VirtualDirectory%>/images/bg.jpg" bgcolor="#C4D2FB" class="titlework style1">Adding for Work Action With Role Based View </td>
		         </tr>

				  <tr bgcolor="#FFFFFF">
				    <td>
				    <div id="hiderole" style="height:260;width=680;overflow:auto">
				    	<table width="100%" height="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#447392">

							<TR valign="top" bgcolor="#FFFFFF">
								<TD colspan=4 bgcolor="#EFF3FA">&nbsp;
									<div id="divgrid" style="top:40">&nbsp;</div>
								</TD>
							</TR>
								<!--Code for Resource Property --Start-->
							   <tr bgcolor="#FFFFFF">
								<td width="80%" bgcolor="#EFF3FA">
								<div id="divResCond" style="display:none">Build the participant filter based on the parameters given below:<br>
										<table border="0"  width="100%">
										<td bgcolor="#EFF3FA">
											<SELECT id="Select1" name="Select1" onchange="return Select1_onchange();">
												<OPTION value="(,(" selected>'('</OPTION>
												<%#resourceproperties%>
											</SELECT>
										</td>
										<td bgcolor="#EFF3FA">
											<SELECT id="Select2" name="Select2">
												<OPTION value=" = " selected>=</OPTION>
												<OPTION value=" > ">&gt;</OPTION>
												<OPTION value=" < ">&lt;</OPTION>
												<OPTION value=" >= ">&gt;=</OPTION>
												<OPTION value=" <= ">&lt;=</OPTION>
												<OPTION value=" <> ">&lt;&gt;</OPTION>
												<OPTION value=" IN ">IN</OPTION>
												<OPTION value=" Contains ">Contains</OPTION>
												<OPTION value=" NotIn ">Not In</OPTION>
											</SELECT>
										</td>
										<td bgcolor="#EFF3FA">
											<SELECT id="Select3" name="Select3" language="javascript" onchange="return Select3_onclick();">
												<OPTION value="Value" selected>Value</OPTION>
												<OPTION value="Variable">Variable</OPTION>
												<OPTION value="Content">Content</OPTION>
												<OPTION value=""></OPTION>
											</SELECT>
										</td>
										<td bgcolor="#EFF3FA">
											<div id="exprres2">&nbsp;</div>
										</td>
										<td bgcolor="#EFF3FA">
											<SELECT id="Select5" name="Select5">
												<OPTION value="End" selected>End</OPTION>
												<OPTION value=" And ">And</OPTION>
												<OPTION value=" Or ">Or</OPTION>
												<OPTION value=") And ">')' And</OPTION>
												<OPTION value=") Or ">')' Or</OPTION>
											</SELECT>
										</td>
										<td width="100" bgcolor="#EFF3FA">
											<INPUT id="btnadd" class="input-buttonswork" type="button" value=" Add " name="btnadd" onclick="return Button1_onclick();">&nbsp;
											<INPUT id="btnundo" class="input-buttonswork" type="button" value="Undo" name="btnundo" language="javascript" onclick="return undo_onclick()">
										</td>

									</table>
								  </div>
							     </td>
						  </tr>

							<tr bgcolor="#FFFFFF">
								<td valign="top" bgcolor="#EFF3FA" id="TDResourceSelection" style="display:none">
									<div id="exprstr" name="exprstr">&nbsp;</div>
								</td>
							</tr>
							<!--Code for Resource Property --End-->
							<tr align="right" bgcolor="#EFF3FA">
							  <td colspan="4" bgcolor="#ffffff" >
								<div id="divgridactionbuttons" style="display:none;">
									<input name="wf_addrow" type="button" class="input-buttonswork" onclick="addnewrow();" value="Save and Add row">
									<input name="wf_removerow" type="button" class="input-buttonswork" onclick="removeselected();" value="Remove selected">
									<INPUT  class="input-buttonswork" type="button" value="Next" name="btnNext" onclick="showRole();">
								</div>
							  </td>
							</tr>
							<tr>
							<td colspan=4 bgcolor="#6A98BB" height="24"></td>
							</tr>
			          </table>
			          </div>
				    </td>
  				  </tr>
				<!---New Code -->
				<tr bgcolor="#FFFFFF">
				    <td>
				    <div id="hideroledet" style="display:none">
				    <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#447392">
				        <tr bgcolor="#FFFFFF">
				          <td  bgcolor="#E7EFFE">Role Name:</td>
				          <td bgcolor="#F6F7F7">
				          	<SELECT class=list id="SelRoleName" name="SelRoleName" onchange="DisplayForSelectedRole()">
							<%#rolenames%>
							</SELECT>
				          </td>
				        </tr>
				        <tr bgcolor="#FFFFFF">
				          <td bgcolor="#E7EFFE">File Name:</td>
				          <td bgcolor="#F6F7F7"><SELECT class=list id="SelTempName" name="SelTempName" onChange="Checkvalidate()">
							<%#filenames%>
						</SELECT></td>
				        </tr>
				        <tr bgcolor="#FFFFFF">
				          <td bgcolor="#E7EFFE">* GroupUI File Name:</td>
				          <td bgcolor="#F6F7F7"><SELECT class=list id="SelGroupUIName" name="SelGroupUIName">
							<%#GroupUIfilenames%>
						</SELECT></td>
				        </tr>
				        <tr align="center" bgcolor="#FFFFFF">
				          <td colspan="2" bgcolor="#84B1CF">
				          <input type="radio" name="radActionOutput" onclick="javascript:DisplaydivActionOutput()">
				            Action Output
				            <input type="radio" name="radInput" onclick="javascript:DisplaydivInputVariables()">
				            Input Variables
				            <input type="radio" name="radOutput" onclick="javascript:DisplaydivOutputVariables()">
				            Output Variables </td>
				        </tr>

				        <TR valign="top" bgcolor="#FFFFFF">
							<TD colspan=4 bgcolor="#FFFFFF">&nbsp;
								<div id="divActionOutput" style="display:none;height:400;width=600;overflow:auto">
									<%#ActionOutputDetails%>
								</div>
								<div id="divInputVariables" style="display:none;height:400;width=600;overflow:auto">
									<%#InputVariableDetails%>
								</div>
								<div id="divOutputVariables" style="display:none;height:400;width=610;overflow:auto">
									<%#OutputVariableDetails%>
								</div>
							</TD>
						</TR>

						<TR bgcolor="#FFFFFF">
							<TD align="left" colspan=4 bgcolor="#E7EFFE">
								* GroupUI File Name : This template will be used for displaying to the participants
								when GroupUI is enabled in the activitylist control.<br>
								GroupUI(Used to display when participant want to act on multiple activities).
							</TD>
						</TR>
						<TR bgcolor="#FFFFFF">
							<TD align="left" colspan=4 id="TDSave" bgcolor="#E7EFFE">
							To Set the value for Action Outputs,Input Variables,Output Variables
							Click on the radio button,provide the values and click on the Save button below.
							</TD>
						</TR>


						<TR valign="top" bgcolor="#FFFFFF">

							<TD colspan=3 align="right" bgcolor="#ffffff">

								<INPUT  class="input-buttonswork" type="button" value="View Role Filter" name="btnback" onclick="showRolegrid();">
								<!--<input type="button" class="input-buttonswork"  name="btnModify" value="Update" onclick="saveForm()">-->
								<input type="button" class="input-buttonswork"  name="btnSave" value="Save" onclick="saveForm()">
								<input type="button" class="input-buttonswork"  name="btnClose" value="Close" onclick="javascript:window.close()">
							</TD>
					 </TR>
					 <tr>
					 <td colspan="3" bgcolor="#6A98BB" height="24"></td>
					 </tr>
					</table>
				      </div>
			      </td>
  				</tr>

				<!--New Code -->


			<input type="hidden" name="hidlistcount" value="<%#listcount%>">
			<input type="hidden" name="hidinputtxtboxcount" value="<%#inputtxtboxcnt%>">
			<input type="hidden" name="hidinputdropdowncount" value="<%#inputdropdowncnt%>">
			<input type="hidden" name="hidfieldcollectioncount" value="<%#Fieldcollectioncount%>">
			<input type="hidden" name="hidoutputcount" value="<%#outputtxtboxcnt%>">
			<input type="hidden" name="_hidtempstore" id="_hidtempstore" value="<%#hidtempstore%>">
			<input type="hidden" name="_mode" ID="_mode">
			<input type="hidden" name="_pageinfo" id="_pageinfo">
			<input type="hidden" name="hidrolemode" id="hidrolemode" value="<%#hidrolemode%>">
			<input type="hidden" name="hidrolevalue" id="hidrolevalue">
			<input type="hidden" name="hiddisplay" id="hiddisplay">
			</div>
		</FORM>


		<SCRIPT>

			//Var to check role is added
			var chkrole=false;
			//variable declaration for scroll
			var obj;
			var height=255;
			var imgtop=40;
			var visiblewidth = 460 + 20;
			var visible=180;
			var visibletop=0;
			var slidespeed =10;
			var visibleheight=180;
			var stopslidingup=false;
			var stopslidingdn=false;
			//*************************************

			var errstr="";
			var rowempty=false;
			var cols= new Array(0);
			var rows= new Array(0);
			var CustomControls = new Array();
			var gridwidth = 460;


			AddColumn('Specify Role',150,null,null,true,'','','');
			AddColumn('Role Button',90,'button',null,true,'','',' Define Filter ');
			AddColumn('Specified Filter',380,null,null,true,'','','');

			<%#addrow%>

			DrawGrid();

			function showRole()
			{
				var err=checkandaddvalues();
				if( (rowempty) || (!rowempty && !err) )
				{
				DrawGrid();
				chkrole=true;
				}

				if(!chkrole)
				 {
					alert("Please enter the values for role in the grid and proceed.");
					return false;
				 }

				document.getElementById("hideroledet").style.display="block";
				document.getElementById("hiderole").style.display="none";
				checktoselect();



			}
			function showRolegrid()
			{
				document.getElementById("hideroledet").style.display="none";
				document.getElementById("hiderole").style.display="block";
				self.resizeTo(700,310);

			}



			function findObj(n, d)
			{
				var p,i,x;
				if(!d) d=document;
				if((p=n.indexOf("?"))>0&&parent.frames.length)
				{
					d=parent.frames[n.substring(p+1)].document;
					n=n.substring(0,p);
				}
				if(!(x=d[n])&&d.all) x=d.all[n];
				for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
				for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
				if(!x && d.getElementById) x=d.getElementById(n);
				return x;
			}


			function GetControlText(ControlName, ControlType, Width, TabIndex, Values,defaultvalue,Mode)
			{
				var controltext="";
				var valuearray;
				var i;

				var widthstr;

				if(Width > 0)
					widthstr = "width: "+Width;
				else
					widthstr = "";

				switch(ControlType)
				{
					case "select":
						controltext = "<SELECT name=\""+ControlName+"\" class=gridtableinputs style='"+widthstr+"' TABINDEX='"+TabIndex+"'>";
						var selectvalues=Values.split(",");

						for(i=0;i<selectvalues.length;i++)
						{
							valuearray = selectvalues[i].split(":");
							if (defaultvalue == valuearray[1])
								controltext	+= "<OPTION value=\"" + valuearray[1] + "\" selected>" + valuearray[0] + "</OPTION>";
							else
								controltext	+= "<OPTION value=\"" + valuearray[1] + "\">" + valuearray[0] + "</OPTION>";
						}
						controltext += "</SELECT>";
						break;
					case "button":
						controltext ="<input name=\""+ControlName+"\" class=input-buttonswork type=button style='"+widthstr+"' TABINDEX='"+TabIndex+"' value='"+ defaultvalue+"' onClick='javascript:Generate()'>";
						break;
					default:
					if(Mode=="True")
						controltext ="<input name=\""+ControlName+"\" class=gridtableinputs type=textbox readOnly style='"+widthstr+"' TABINDEX='"+TabIndex+"' value='"+ defaultvalue+"'>";
					else
						controltext ="<input name=\""+ControlName+"\" class=gridtableinputs type=textbox  style='"+widthstr+"' TABINDEX='"+TabIndex+"' value='"+ defaultvalue+"'>";

					break;

				}

				return controltext;
			}

			function getcustomcontrolindex(controlname)
			{
				var returnvalue=-1;
				var i=0;
				for(i=0;i<CustomControls.length;i++)
				{
					if (CustomControls[i].name == controlname)
						returnvalue = i;
				}
				return returnvalue;
			}

			function row()
			{
				this.selected =false;
				this.cols = new Array(cols.length);
			}

			function col()
			{
				this.titlestring = "";
				this.width=0; //Max width of the field
				this.type="";
				this.values="";
				this.mandatory=false;
				this.displaywidth=""; //Display width for the column (to be specified with the TD tag)
				this.validationtype="";
			}

			function AddColumn(titlestring,width,type,values,mandatory,displaywidth,validationtype,defaultvalue)
			{
				var arrayindex = 0;
				arrayindex  = cols.length;
				cols[arrayindex] = new col();
				cols[arrayindex].titlestring = titlestring;

				//if( parseInt(width) >= 100 )
				//	cols[arrayindex].width = 0;
				//else
				//	cols[arrayindex].width = (parseInt(gridwidth)) * parseInt(width) / 100;

				cols[arrayindex].width = parseInt(width);
				cols[arrayindex].displaywidth = displaywidth;
				cols[arrayindex].mandatory = mandatory;
				cols[arrayindex].validationtype = validationtype;
				cols[arrayindex].defaultvalue = defaultvalue;
				if( type != null )
				{
					if( type == "select" )
					{
						cols[arrayindex].type = type;
						cols[arrayindex].values=values;
					}
					else if(type =="button")
					{

						cols[arrayindex].type = type;

					}


				}
			}

			function AddRow()
			{
				var newarrayid = rows.length;
				rows[newarrayid] = new row();
				for (i=0;i<cols.length;i++)
				{
					if((arguments.length-1) >= i)
					{
						rows[newarrayid].cols[i] = arguments[i];
					}
					else
					{
						rows[newarrayid].cols[i] = "";
					}
				}
			}

			function DrawGrid()
			{

				if(navigator.userAgent.indexOf("Netscape") >0 )
						document.all = document.getElementsByTagName("*");
				document.getElementById("divgridactionbuttons").style.display='block';
				var obj = document.all["divgrid"];
				var controltext ="";
				var customcontrolindex;

				var innerhtml="";
				var colwidth=0;
				//innerhtml = "<TABLE width=460 bgcolor=#808080 cellspacing=1>";
				innerhtml = "<TABLE width=<%#gridwidth%> bgcolor=#808080 cellspacing=1>";

				innerhtml += "<TR bgcolor=#6A98BB>";
				innerhtml += "<TD bgcolor=#6A98BB width=15>&nbsp;</TD>";

				for (i = 0;i<cols.length;i++)
				{
					innerhtml += "<TD  width='"+cols[i].displaywidth+"'>";
					innerhtml += cols[i].titlestring;
					innerhtml +="</TD>";
				}
				innerhtml +="</TR>";
				for (i = 0;i<rows.length;i++)
				{
					innerhtml +="<TR bgcolor=white>";
					innerhtml += "<TD bgcolor=#6A98BB width=15>&nbsp;</TD>";
					for(j=0;j<cols.length;j++)
					{
						innerhtml += "<TD height=15 >";
						innerhtml += "<div id='row" + i +"col" + j +"'>" + GetDisplayString(i,j,rows[i].cols[j]) + "</div>";
						innerhtml += "</TD>";
					}
					innerhtml +="</TR>";
				}

				innerhtml += "<TR bgcolor=white>";
				innerhtml += "<TD bgcolor=#6A98BB width=15>&nbsp;</TD>";

				var txtReadonly="";

				for (i = 0;i<cols.length;i++)
				{
					colwidth = cols[i].width;
					if (parseInt(colwidth) ==0)
						colwidth = parseInt(gridwidth) / (cols.length + 1);

					innerhtml += "<TD>";
					if(i==2)
					{
					txtReadonly="True";
					}
					controltext=GetControlText("wf_gridinput" + i ,cols[i].type, cols[i].width, i+1, cols[i].values,cols[i].defaultvalue,txtReadonly);

					innerhtml += controltext;
					innerhtml +="</TD>";
				}
				innerhtml +="</TR>";
				innerhtml +="</TABLE>";
				obj.innerHTML = innerhtml;
				height = (rows.length * 15) + 60;
				window.setTimeout('findObj("wf_gridinput0").focus();',250);
			}

			function GetDisplayString(rowid,colid,string)
			{
				var colwidth = cols[colid].width;
				var displaystring =string;
				/*if (parseInt(colwidth) ==0)
					colwidth = parseInt(gridwidth) / (cols.length + 1);

				var returnvalue="";
				colwidth = parseInt(colwidth/7)-1;
				if (string.length > colwidth )
				{
					displaystring = displaystring.substring(0,colwidth) + "...";
				}*/

				if (string.length > 0)
					returnvalue = "<A title='" + string + "' class=gridanchor href='javascript:selectrow("+ rowid +")'>" + displaystring + "</A>";
				else
					returnvalue = "&nbsp;";
				return returnvalue;
			}

			function addnewrow()
			{

				if( !checkandaddvalues() )
				{
					DrawGrid();
					chkrole=true;
				}
				else
				{
					alert(errstr);
					window.setTimeout('findObj("wf_gridinput0").focus();',250);
				}

				if(sDispExpression!="")
				{
					sDispExpression="";
				}

				if(sExpression!="")
				{
					sExpression="";
				}

			}

			function removeselected()
			{

				// for  Removing the role filled in the dropdown if we remove from the grid...

					var temparrayremove=new Array();
					for (i=0;i<rows.length;i++)
					{
						if (rows[i].selected)
						{
							temparrayremove[temparrayremove.length] = rows[i];

						}
					}
					var roletoremove;
					var strroleremovefromroles="";
					for (i=0;i<temparrayremove.length;i++)
					{

						for (j=0;j<cols.length;j++)
						{
							if(j==0)
							{
								roletoremove=temparrayremove[i].cols[0];
								if(strroleremovefromroles =="")
								{
								strroleremovefromroles+=roletoremove;
								}
								else
								{
								strroleremovefromroles+=","+roletoremove;
								}
								delOptions(roletoremove);
							}
						}

					}
				// for  Removing the role filled in the dropdown if we remove from the grid...


				var temprows=new Array();
				var arrayindex = 0;
				for (i=0;i<rows.length;i++)
				{
					if (! rows[i].selected)
					{
						temprows[temprows.length] = rows[i];
					}
				}
				rows = temprows;
				DrawGrid();

				if(sDispExpression!="")
				{
					sDispExpression="";
				}

				if(sExpression!="")
				{
					sExpression="";
				}


				document.wf_theform._mode.value='remove';
				var selrolevalue = document.wf_theform.SelRoleName.value;
			    document.wf_theform._hidtempstore.value=strroleremovefromroles+"!"+selrolevalue+"*"+getgridvalues();
			    document.wf_theform.submit();
			}

	//For Removing the Role from the dropdown when we remove the role from the grid
			 function delOptions(chosen)
			 {
					var selbox = document.getElementsByTagName("select")["SelRoleName"];
					if (selbox.options[0].value != " ")
						{
							nomatch = new Array();
							for (n=0;n<selbox.length;n++)
			 				{
								if(selbox.options[n].text != chosen)
								{
									nomatch[nomatch.length] = new Array(selbox.options[n].value, selbox.options[n].text);
								}
							}
							selbox.options.length = 0;
							if (nomatch.length != 0)
								{
									for (n=0;n<nomatch.length;n++)
									{
									selbox.options[n] = new Option(nomatch[n][1], nomatch[n] [0]);
									}
								}
						}
			}

			function checkandaddvalues()
			{
				var temprow = new row();
				var flag = false;
				var err=false;

				errstr="";
				if(navigator.userAgent.indexOf("Netscape") >0 )
					document.all = document.getElementsByTagName("*");

				var obj;
				for (i=0;i<cols.length;i++)
				{
					obj = document.all["wf_gridinput" + i];
					//alert(cols[i].validationtype)
					if (obj.value.length > 0 )
					{
						 if(i!=0 && i!=2)
						 {
							flag=true;
							if( cols[i].validationtype.length > 0 && cols[i].validationtype == "timespan")
							{
								var toMatchstr = obj.value
								if (toMatchstr.indexOf(".") < 0 )
									toMatchstr += ".00:00:00"

								var timeSpanPat = /^\d*\.[0-2]{1}[0-3]{1}\:[0-5]{1}[0-9]{1}\:[0-5]{1}[0-9]{1}/;
								var timeSpanPat1 = /^\d*\.[0-1]{1}[0-9]{1}\:[0-5]{1}[0-9]{1}\:[0-5]{1}[0-9]{1}/;
								var matchArray = toMatchstr.match(timeSpanPat);
								var matchArray1 = toMatchstr.match(timeSpanPat1);
								if(matchArray == null && matchArray1 == null)
								{
									err=true;
									errstr += "Not a valid Time Span (dd.hh:mm:ss) Value "+ cols[i].titlestring +"\r\n";
								}
						 }
							}
						}
					else

						if( cols[i].mandatory)
						{
							err=true;
							errstr += "Please specify value for "+cols[i].titlestring+"\r\n";
						}



					temprow.cols[i] = obj.value;
				}
				if (flag && !err)
					rows[rows.length] = temprow;

				//if(rows.length == 0 && !flag)
				//	flag = false;

				rowempty = !flag;
				return (err);

			}

			function selectrow(rowid)
			{
				var obj
				for (i=0;i<cols.length;i++)
				{
					obj = document.all["row"+rowid + "col" + i];
					if (rows[rowid].selected)
						obj.style.backgroundColor = "white";
					else
						obj.style.backgroundColor = "#DBEAF5";
				}
				rows[rowid].selected  = !rows[rowid].selected;
			}

			function getgridvalues()
			{
				var returnstring="";
				var returnsubstring = "";
				returnstring += ConvertToString(rows.length,4);
				for (i=0;i<rows.length;i++)
				{
					returnsubstring = "";
					returnsubstring += ConvertToString(cols.length,4);

					for (j=0;j<cols.length;j++)
					{
						returnsubstring += "$" + ConvertToString(rows[i].cols[j].length,4)+rows[i].cols[j] ;
					}

					returnsubstring = ConvertToString(returnsubstring.length,4)+returnsubstring;
					returnstring +="#" + returnsubstring;
				}


				return returnstring;
			}

			function ConvertToString(  number,  width )
			{
				var str="";
				var i;

				str=number.toString();
				var l = str.length;
				for(i=0;i<(width-l);i++)
				{
					str = "0" + str;
				}
				return str.substring(0,width);
			}


			function submitform()
			{
				var err=checkandaddvalues();
				if( (rowempty) || (!rowempty && !err) )
				{
					var sSubmit=getgridvalues();
					window.opener.properties("_hidtempstore",getgridvalues());
					window.opener.submitform("?mode=edit&<%#qspropertypagename%>=<%#propertypage%>&<%#qspropertyname%>=<%#propertyname%>&<%#SelectedItemQueryString%>");
					window.close();
				}
				else
				{
					alert(errstr);
					window.setTimeout('findObj("wf_gridinput0").focus();',250);
				}
			}


			function PopulateListBox(RoleValue)
  	        {

  	        	 if(RoleValue != "")
					{
					   NewOpt =  new Option;
					   NewOpt.value = RoleValue;
			           NewOpt.text = RoleValue;

			           document.getElementsByTagName("select")["SelRoleName"].options.value =  NewOpt;
					}

			       document.getElementsByTagName("select")["SelRoleName"].options[0].selected = true;

 			}


 		function Generate()
		 {
				var ElmntRegExp;
				var ElmntRolevalue;

				for(i=0;i< document.forms[0].elements.length-1;i++)
					{
						if (document.forms[0].elements[i].name=="wf_gridinput2")
						{
							ElmntRegExp=i;
						}
						if (document.forms[0].elements[i].name=="wf_gridinput0")
						{
							ElmntRolevalue=i;
						}


					}
				 //document.forms[0].elements[ElmntRegExp].value="Test";

				 var RoleValue=document.forms[0].elements[ElmntRolevalue].value;
				 var RoleFound="false";

				//for filling the value of the dropdown of role

					if(RoleValue != "")
					{

					   for(i=0;i<document.getElementsByTagName("select")["SelRoleName"].options.length;i++)
					   {
						 if(RoleValue.toUpperCase()==document.getElementsByTagName("select")["SelRoleName"].options[i].value.toUpperCase())
						 {
						  RoleFound="true";

						 }

					   }
					   NewOpt =  new Option;
					   NewOpt.value = RoleValue;
					   NewOpt.text = RoleValue;
					   if(RoleFound=="false")
						document.getElementsByTagName("select")["SelRoleName"].options[document.getElementsByTagName("select")["SelRoleName"].options.length]=NewOpt;
					}

				  //document.getElementsByTagName("select")["SelRoleName"].options[0].selected = true;
				  document.getElementById("divResCond").style.display='block';
				  document.getElementById("btnadd").disabled=false;

			 }


    </SCRIPT>

<!--Script Code for Resource Property --Start-->
    <script language="javascript">
			var i=0;
			var oexprstr;
			var sExpression="";
			var sDispExpression="";
			var iOpenBrackets=0;

			var undoExpression;
			var undoDispExpression;
			var undoOpenBrackets;


			var valueresdiv = "<input id='valueresinput' type='text'>";

			var variableresdiv = "<SELECT id='valueresinput'>";
			variableresdiv += "<%#assignresvariables%>";
			variableresdiv +=	"</SELECT>";

			var contentresdiv = "<SELECT id='valueresinput'>";
			contentresdiv += "<%#assignrescontent%>";
			contentresdiv +=	"</SELECT>";

			var oexpr2;

			oexpr2 = document.getElementsByTagName("div")["exprres2"];

			function changeResDiv( divvar )
			{
				if( !oexpr2 )
					oexpr2 = document.getElementsByTagName("div")["exprres2"];

				oexpr2.innerHTML = eval(divvar);
			}

			function Select3_onclick()
			{

				var oselect3 = document.getElementsByTagName("select")["Select3"];

				switch(oselect3.value)
				{
					case "Value": changeResDiv("valueresdiv");
								break;
					case "Variable": changeResDiv("variableresdiv");
									break;

					case "Content": changeResDiv("contentresdiv");
									break;
				}

				return false;
			}

			function init()
			{
				Select3_onclick();
				Select1_onchange();
				document.getElementsByTagName("input")["btnundo"].disabled=true;
				//document.getElementsByTagName("input")["button3"].disabled=true; //Submit button initially disabled
				if( sExpression != "" )
					document.getElementsByTagName("input")["btnadd"].disabled=true; //Disable Add button
				else
					document.getElementsByTagName("input")["btnadd"].disabled=false; //Enable Add button
				show_expression(sDispExpression);
			}

			function Select1_onchange()
			{
				var oselect1 = document.getElementsByTagName("select")["Select1"];
				var odiv = document.getElementsByTagName("div")["otherinputs"];
				var o = document.getElementsByTagName("*")["valueresinput"];

				var values = oselect1.value.split(",");

				switch(values[1])
				{
					case "(":  document.getElementsByTagName("select")["Select2"].disabled=true;
							document.getElementsByTagName("select")["Select3"].disabled=true;
	   						document.getElementsByTagName("select")["Select5"].disabled=true;
							if( o )  o.disabled=true;
	 						break;
					default:   document.getElementsByTagName("select")["Select2"].disabled=false;
							document.getElementsByTagName("select")["Select3"].disabled=false;
							document.getElementsByTagName("select")["Select5"].disabled=false;
							if( o) o.disabled=false;
							break;
				}

			}


			function get_framediv()
			{
				var framedoc;

				var frameobj;

				if(navigator.userAgent.indexOf("Netscape") >0 )
				{
					document.all = document.getElementsByTagName("iframe");
					frameobj = document.all["expr"];
					framedoc = frameobj.contentDocument.getElementsByTagName("*");
					oexprstr = framedoc["exprstr"];
				}
				else
				{
					//frameobj = document.frames["expr"];
					//oexprstr = frameobj.document.all["exprstr"];
					oexprstr = document.all["exprstr"];
				}

			}

			function show_expression(expression)
			{
				//making it as null and adding fresh


							if( !oexprstr )
								get_framediv();

							oexprstr.innerHTML = expression;

							var ElmntRegExp;

							for(i=0;i< document.forms[0].elements.length-1;i++)
							{

								if (document.forms[0].elements[i].name=="wf_gridinput2")
									{
											ElmntRegExp=i;
									}
							}

							document.forms[0].elements[ElmntRegExp].value=expression;


							document.getElementById("divResCond").style.display='none';
							document.getElementById("TDResourceSelection").style.display='none';
							//document.getElementsByTagName("input")["btnundo"].disabled=false;

			}

			function set_undovalues()
			{
				undoExpression = sExpression;
				undoDispExpression = sDispExpression;
				undoOpenBrackets = iOpenBrackets;
				document.getElementsByTagName("input")["btnundo"].disabled=false;
			}

			function Button1_onclick()
			{


				//sDispExpression="";
				//sExpression="";
				var retval=false;

				var oselect1 = document.getElementsByTagName("select")["Select1"];
				var select1values = oselect1.value.split(",");

				if( select1values[1] == "(" )
				{
					set_undovalues();
					sExpression += "(";
					sDispExpression += "(";
					iOpenBrackets++;
				}
				else
				{
					var oselect2 = document.getElementsByTagName("select")["Select2"];
					var oselect3 = document.getElementsByTagName("select")["Select3"];
					var oselect5 = document.getElementsByTagName("select")["Select5"];
					//var o = document.getElementsByTagName("*")["valueresinput"];
					//For IE 5.5 compatibility
					if(typeof(document.getElementsByTagName("input")["valueresinput"]) != 'undefined')
						var o = document.getElementsByTagName("input")["valueresinput"];
					else if(typeof(document.getElementsByTagName("select")["valueresinput"]) != 'undefined')
						var o = document.getElementsByTagName("select")["valueresinput"];
					else
						var o = document.getElementsByTagName("*")["valueresinput"];

					var endcond=false;

					if( oselect5.value.substring(0,1) == ")" ) //Incase no open brackets pending dont allow to close the bracket
						if( iOpenBrackets <= 0 )
							return retval;
						else
							iOpenBrackets--;


					if( oselect5.value == "End" )
						endcond=true;

					set_undovalues();

					sExpression += "["; sDispExpression += "[";
					sExpression += select1values[1]; sDispExpression += select1values[0];
					sExpression += "]"; sDispExpression += "]";
					sExpression += oselect2.value; sDispExpression += oselect2.value;
					sExpression += "["; sDispExpression += "[";

					if( oselect3.value != "Value" )
					{
						if(typeof(((o.value.split(","))[1])) == 'undefined')
						{
							sExpression += ((o.value.split(","))[0]);
						}
						else
						{
							sExpression += ((o.value.split(","))[1]);
						}
						sDispExpression += ((o.value.split(","))[0]);
					}
					else
					{
					 	sExpression += '"'+o.value+'"';
						sDispExpression += '"'+o.value+'"';
					}

					sExpression += "]"; sDispExpression += "]";

					if( !endcond )
					{
						sExpression += " "+oselect5.value;
						sDispExpression += " "+oselect5.value;
					}
					else
					{
						while( iOpenBrackets > 0)
						{
							sExpression += ")"; sDispExpression += ")";
							iOpenBrackets--;
						}
						//document.getElementsByTagName("input")["button3"].disabled=false; //Enable submitt button
						//document.getElementsByTagName("input")["Button1"].disabled=true; //Disable Add button
					}
				}
				show_expression(sDispExpression);
				return retval;
			}

			function Button2_onclick()
			{
				sExpression="";
				sDispExpression="";
				iOpenBrackets=0;
				document.getElementsByTagName("input")["button3"].disabled=true; //Submit button enabled after clearing
				document.getElementsByTagName("input")["Button1"].disabled=false; //Enable Add button
				show_expression(sDispExpression);
			}

			function undo_onclick()
			{
				sExpression = undoExpression;
				sDispExpression = undoDispExpression;
				iOpenBrackets = undoOpenBrackets;
				document.getElementsByTagName("input")["btnundo"].disabled=true; //Disable undo button
				//document.getElementsByTagName("input")["button3"].disabled=true; //Disable Submit button
				document.getElementsByTagName("input")["btnadd"].disabled=false; //Enable Add button
				show_expression(sDispExpression);
			}

			function ConvertToString(  number,  width )
			{
				var str="";
				var i;

				str=number.toString();
				var l = str.length;
				for(i=0;i<(width-l);i++)
				{
					str = "0" + str;
				}
				return str.substring(0,width);
			}

			function submitform()
			{

				var submitvalue="";
				submitvalue = ConvertToString( sExpression.length, 4 ) + sExpression + ConvertToString( sDispExpression.length, 4) + sDispExpression;
				window.opener.properties("_hidtempstore",submitvalue);
				window.opener.submitform("?mode=edit&<%#qspropertypagename%>=<%#propertypage%>&<%#qspropertyname%>=<%#propertyname%>&<%#SelectedItemQueryString%>");
				window.close();
			}


		</script>

<!--Script Code for Resource Property --Start-->

<script language=javascript>

			//This is to show the buttons based on Add mode or edit mode

				/*if(document.wf_theform.hidfieldcollectioncount.value==0)
				{

					document.wf_theform.btnModify.style.display='none';
					document.getElementById("TDModify").innerText='';
				}
				else if(document.wf_theform.hidfieldcollectioncount.value>0)
				{

					document.wf_theform.btnSave.style.display='none';
					document.getElementById("TDSave").innerText='';

				}
				else if(document.wf_theform._hidtempstore.value=="")
				{
					document.getElementById("TDModify").innerText='';
				}*/



			//For displaying the dropdown and changing the values
				var valuepropertydiv = "<SELECT id='valueinput' class=list>";
				valuepropertydiv += "<%#assignvalue%>";
				valuepropertydiv +=	"</SELECT>";


				var varpropertydiv = "<SELECT id='valueinput' class=list>";
				varpropertydiv += "<%#assignvariables%>"
				varpropertydiv += "</SELECT>";


				var contentpropertydiv = "<SELECT id='valueinput' class=list>";
				contentpropertydiv +=  "<%#assigncontent%>";
				contentpropertydiv +=  "</SELECT>";

				var valuediv= "<input type=textbox id='valueinput' class='inputs' >";

			//For displaying the dropdown and changing the values

				//For changing the div on selection of dropdown
				function changeDiv( divvar,divname )
				{
					var oexpr2;
					if( !oexpr2 )
						oexpr2 = document.getElementsByTagName("div")[divname];
						oexpr2.innerHTML = eval(divvar);

				}

				function Select_onclick(selectname,divname)
				{

					var oselect3 = document.getElementsByTagName("select")[selectname];

					switch(oselect3.value)
					{

						case "value": changeDiv("valuediv",divname);
						break;
						case "valueproperty": changeDiv("valuepropertydiv",divname);
						break;
						case "varproperty": changeDiv("varpropertydiv", divname);
						break;
						case "dateproperty": changeDiv("datepropertydiv", divname);
						break;
						case "contentproperty": changeDiv("contentpropertydiv", divname);
						break;

						default: changeDiv("valuediv",divname);
						break;

					}

					return false;
				}


				var val="";

				function DisplaydivActionOutput()
				{


				  if(!rowempty && chkrole)
				  {
					 var sSubmit=getgridvalues();
				  }
				 if(!chkrole)
				 {
				 	alert("Please enter the values for role in the grid and proceed.");
				 	return false;
				 }
				  roleval=document.wf_theform.SelRoleName.value;
				  val=document.wf_theform.SelTempName.value;
				  val=val+"$"+"ActionOutputs"+"^"+sSubmit;
				  document.wf_theform._mode.value='withroleload';
				  document.wf_theform._hidtempstore.value=val;
				  document.wf_theform.hidrolevalue.value=roleval;
				  document.wf_theform.submit();

				}
				function DisplaydivInputVariables()
				{
				  if(!rowempty && chkrole)
				  {
					 var sSubmit=getgridvalues();
				  }
				  if(!chkrole)
				   {
				  	alert("Please enter the values for role in the grid and proceed.");
				  	return false;
				  }
				  roleval=document.wf_theform.SelRoleName.value;
				  val=document.wf_theform.SelTempName.value;
				  val=val+"$"+"InputVariables"+"^"+sSubmit;
				  document.wf_theform._mode.value='withroleload';
				  document.wf_theform._hidtempstore.value=val;
				  document.wf_theform.hidrolevalue.value=roleval;
				  document.wf_theform.submit();

				}
				function DisplaydivOutputVariables()
				{
					if(!rowempty && chkrole)
					  {
						 var sSubmit=getgridvalues();
					  }
					if(!chkrole)
					   {
						alert("Please enter the values for role in the grid and proceed.");
						return false;
				       }
				  roleval=document.wf_theform.SelRoleName.value;
				  val=document.wf_theform.SelTempName.value;
				  val=val+"$"+"OutputVariables"+"^"+sSubmit;
 	  			  document.wf_theform._mode.value='withroleload';
  				  document.wf_theform._hidtempstore.value=val;
  				  document.wf_theform.hidrolevalue.value=roleval;
				  document.wf_theform.submit();
				}

				function DisplayForSelectedRole()
				{

				 if(!rowempty)
				  {
					 var sSubmit=getgridvalues();
				  }
				  roleval=document.wf_theform.SelRoleName.value;
				  document.wf_theform._mode.value='withroleload';
				  document.wf_theform._hidtempstore.value=sSubmit;
				  document.wf_theform.hidrolevalue.value=roleval;
				  document.wf_theform.submit();

				}


				function checktoselect()
				{


					var Fldcollectioncnt=document.wf_theform.hidfieldcollectioncount.value;

					var arrhidtempstore="";
					  if(document.wf_theform._hidtempstore.value !="")
						{
							arrhidtempstore=document.wf_theform._hidtempstore.value.split("$");
						}

					   if(Fldcollectioncnt==0 && arrhidtempstore =="RoleBased" )
					   {
					  	  	if(chkrole==false)
					  	  	{
					  	  	//For Resizing the Windows
					   		self.resizeTo(700,310);
					   		}
					   		else
					   		{
					   			self.resizeTo(700,340);
					   		}
					   }

					   if(document.wf_theform._hidtempstore.value=="GridOnlyDisplay")
					   {
							chkrole=true;
					   }


					   if(document.wf_theform._hidtempstore.value=="" || arrhidtempstore.length>1)
					   {
					  		chkrole=true;
					   }

					if(arrhidtempstore.length >0 && Fldcollectioncnt==0)
					{

						//For setting the value for role checking in the grid

						if(arrhidtempstore !="RoleBased")
						{
							//For Resizing the Windows
							self.resizeTo(730,740);
							chkrole=true;
							//For Hiding the grid div and displaying the role detaisl div
							document.getElementById("hideroledet").style.display="block";
							document.getElementById("hiderole").style.display="none";
						}

						var Fieldtype=arrhidtempstore[1];


						if(Fieldtype=="ActionOutputs")
						{
							document.wf_theform.radActionOutput.checked="true";
							document.getElementById("divActionOutput").style.display='block';
						}
						else if(Fieldtype=="InputVariables")
						{
							document.wf_theform.radInput.checked="true";
							document.getElementById("divInputVariables").style.display='block';
							var listCount=document.wf_theform.hidinputtxtboxcount.value;
							for(i=0;i<listCount;i++)
							{
								Select_onclick('SelectInputVar'+i,'expr'+i);
							}

							//Set the selected values
							for ( i = 0 ;i<parseInt(listCount);i++)
							{
								if(parseInt(listCount) ==1)
									var tempObj = eval("document.wf_theform.valueinput");
								else
									var tempObj = eval("document.wf_theform.valueinput["+i+"]");

								if(typeof(tempObj) == "undefined")
									tempObj = eval("document.wf_theform.valueinput");
								tempObj.value = eval("document.wf_theform.txtinputvarval"+i+".value")

							}

						}
						else if(Fieldtype=="OutputVariables")
						{
							document.wf_theform.radOutput.checked="true";
							document.getElementById("divOutputVariables").style.display='block';
							var listCount=document.wf_theform.hidlistcount.value;
							for(i=0;i<listCount;i++)
							{
								Select_onclick('SelectOutputVar'+i,'expr'+i);
							}

							//Set the selected values
								for ( i = 0 ;i<parseInt(listCount);i++)
								{
									if(parseInt(listCount) ==1)
										var tempObj = eval("document.wf_theform.valueinput");
									else
										var tempObj = eval("document.wf_theform.valueinput["+i+"]");
									if(typeof(tempObj) == "undefined")
										tempObj = eval("document.wf_theform.valueinput");
										if(eval("document.wf_theform.txtoutputvarval"+i+".value") !="")
										tempObj.value = eval("document.wf_theform.txtoutputvarval"+i+".value")

								}
						}

					 }

					 else if(arrhidtempstore.length >0 && Fldcollectioncnt>0)
					  {

					  //For setting the value for role checking in the grid
					  chkrole=true;

								var Fieldtype=arrhidtempstore[1];

								if(Fieldtype=="ActionOutputs")
								{
									document.wf_theform.radActionOutput.checked="true";
									document.getElementById("divActionOutput").style.display='block';

									//For Hiding the grid div and displaying the role detaisl div
										document.getElementById("hideroledet").style.display="block";
										document.getElementById("hiderole").style.display="none";
								}
								else if(Fieldtype=="InputVariables")
								{
									document.wf_theform.radInput.checked="true";
									document.getElementById("divInputVariables").style.display='block';
									var listCount=document.wf_theform.hidinputtxtboxcount.value;
									for(i=0;i<listCount;i++)
									{
										Select_onclick('SelectInputVar'+i,'exprIpVar'+i);
									}

									//Set the selected values
									for ( i = 0 ;i<parseInt(listCount);i++)
									{
										if(parseInt(listCount) ==1)
											var tempObj = eval("document.wf_theform.valueinput");
										else
											var tempObj = eval("document.wf_theform.valueinput["+i+"]");

										if(typeof(tempObj) == "undefined")
											tempObj = eval("document.wf_theform.valueinput");
										tempObj.value = eval("document.wf_theform.txtinputvarval"+i+".value")

									}

									//For Hiding the grid div and displaying the role detaisl div
										document.getElementById("hideroledet").style.display="block";
										document.getElementById("hiderole").style.display="none";

								}
								else if(Fieldtype=="OutputVariables")
								{
									document.wf_theform.radOutput.checked="true";
									document.getElementById("divOutputVariables").style.display='block';
									var listCount=document.wf_theform.hidoutputcount.value;
									for(i=0;i<listCount;i++)
									{
										Select_onclick('SelectOutputVar'+i,'expr'+i);
									}

									//Set the selected values
									for ( i = 0 ;i<parseInt(listCount);i++)
									{
										if(parseInt(listCount) ==1)
											var tempObj = eval("document.wf_theform.valueinput");
										else
											var tempObj = eval("document.wf_theform.valueinput["+i+"]");
										if(typeof(tempObj) == "undefined")
											tempObj = eval("document.wf_theform.valueinput");
											tempObj.value = eval("document.wf_theform.txtoutputvarval"+i+".value")

									}

									//For Hiding the grid div and displaying the role detaisl div
										document.getElementById("hideroledet").style.display="block";
										document.getElementById("hiderole").style.display="none";

								}

								 //For Resizing the Windows
					 		self.resizeTo(720,740);

					 }
					else if(arrhidtempstore.length==0 && Fldcollectioncnt>0)
					{
					//For setting the value for role checking in the grid
					chkrole=true;

					//For Hiding the grid div and displaying the role details div
						document.getElementById("hideroledet").style.display="block";
						document.getElementById("hiderole").style.display="none";

						 document.wf_theform.radActionOutput.checked="true";
						 document.getElementById("divActionOutput").style.display='block';

						 //For Resizing the Windows
					 		self.resizeTo(720,740);

					 }



				}

				function getselectedvalues()
				{
					var CheckradType="";
					var returnvalue="";
					var i=0;
					var Actionoutputname="";
					var Actionoutputvalue="";
					var ActionoutputCM="";
					var Inputvarname="";
					var Inputvarvalue="";
					var Outputvarname="";
					var Outputvarvalue="";
					var Outputvaroptype="";
					var tempobj;



					//Setting the type on selection of radio buttons

					if(document.wf_theform.radActionOutput.checked)
					{
						CheckradType="AO";
					}
					if(document.wf_theform.radInput.checked)
					{

						CheckradType="I";

					}
					if(document.wf_theform.radOutput.checked)
					{

						CheckradType="O";

					}

					//getting the values and assigning to hidden variable

					if(CheckradType !="")
					{
						var lstCnt=document.wf_theform.hidlistcount.value;

						 if(CheckradType=="AO")
						 {
							for ( i = 0 ;i<parseInt(lstCnt);i++)
							{
								Actionoutputname=eval("document.wf_theform.txtActoutput"+i);
								Actionoutputvalue=eval("document.wf_theform.txtActoutputvalue"+i);
								ActionoutputCM=eval("document.wf_theform.SelectCM"+i);
								if(Actionoutputvalue.value !="")
								{
									if(returnvalue=="")
									{
										returnvalue=Actionoutputname.value+","+Actionoutputvalue.value+","+ActionoutputCM.value;
									}
									else
									{
										returnvalue+="#"+Actionoutputname.value+","+Actionoutputvalue.value+","+ActionoutputCM.value;
									}
								 }
							}
						  }
						//Checking and getting values for input variable selection
						 if(CheckradType=="I")
						   {
						     var inplstcnt=document.wf_theform.hidinputtxtboxcount.value;
						     var inpdropdowncnt=document.wf_theform.hidinputdropdowncount.value;

							  for ( i = 0 ;i<parseInt(inplstcnt);i++)
								{
									Inputvarname=eval("document.wf_theform.txtinputvar"+i);
		  							 if(parseInt(inplstcnt)==1)
										{
											Inputvarvalue = eval("document.wf_theform.valueinput.value");
										}
									 else
										 {
											tempobj=eval("document.wf_theform.valueinput["+i+"]")
											Inputvarvalue=tempobj.value;
										 }
									if(Inputvarvalue !="")
										{
											if(returnvalue=="")
											{
												returnvalue=Inputvarname.value+";"+Inputvarvalue;
											}
											else
											{
												returnvalue+="#"+Inputvarname.value+";"+Inputvarvalue;
											}
										 }
								  }

								 for ( i = 0 ;i<parseInt(inpdropdowncnt);i++)
									{
										Inputvarname=eval("document.wf_theform.txtselinputvar"+i);

										tempobj=eval("document.wf_theform.SelectInput"+i)
										Inputvarvalue=tempobj.value;

										if(Inputvarvalue !="")
											{
												if(returnvalue=="")
												{
													returnvalue=Inputvarname.value+";"+Inputvarvalue;
												}
												else
												{
													returnvalue+="#"+Inputvarname.value+";"+Inputvarvalue;
												}
											 }
								  }

							 }

							//Checking and getting values for output variable selection
							if(CheckradType=="O")
							 {
							 	var outlstcnt=document.wf_theform.hidoutputcount.value;
								for ( i = 0 ;i<parseInt(outlstcnt);i++)
									{
										Outputvarname=eval("document.wf_theform.txtoutputvar"+i);
										Outputvaroptype=eval("document.wf_theform.SelectOPType"+i);
										 if(parseInt(outlstcnt)==1)
											{
												Outputvarvalue= eval("document.wf_theform.valueinput.value");
											}
										 else
										 {
											tempobj=eval("document.wf_theform.valueinput["+i+"]")
											Outputvarvalue=tempobj.value;
										 }


										if(Outputvarvalue  !="")
										{
											if(returnvalue=="")
											{
												returnvalue=Outputvarname.value+","+Outputvarvalue+","+Outputvaroptype.value;
											}
											else
											{
												returnvalue+="#"+Outputvarname.value+","+Outputvarvalue+","+Outputvaroptype.value;
											}
										 }
									 }
							  }

					}
					return 	returnvalue;

				 }

				 function saveForm()
				 {

					//Checking for selection of radio buttons


					if((!document.wf_theform.radActionOutput.checked)&&(!document.wf_theform.radInput.checked)&&(!document.wf_theform.radOutput.checked))
					{
							alert('Please select the radio button to proceed.');
							return false;

					}
					var returnvalue=getselectedvalues();



					if(returnvalue.length==0)
					{
						alert('Please enter the values and proceed');
						return false;
					}

					 var hidval=document.wf_theform._hidtempstore.value;
					 if (hidval=="")
					 {
					 	val=document.wf_theform.SelTempName.value;
					 	if(document.wf_theform.radActionOutput.checked)
					 	{
					 		val=val+"$"+"ActionOutputs";
						 	hidval=val;
						}

						else if(document.wf_theform.radInput.checked)
						{
							val=val+"$"+"InputVariables";
						 	hidval=val;

						}

						else if(document.wf_theform.radOutput.checked)
						{
							val=val+"$"+"OutputVariables";
						 	hidval=val;

						}


					 }
					 document.wf_theform._mode.value='saverole';
					 document.wf_theform._hidtempstore.value=hidval+"~"+returnvalue+"@"+getgridvalues();
					 document.wf_theform.hidrolevalue.value=document.wf_theform.SelRoleName.value;
					 document.wf_theform.submit();

				 }

				 function Checkvalidate()
				 {
				 	alert('Please select the radio button to proceed.');
					return false;
				 }


			//For Resizing the Windows
			self.moveTo(0,0)
			self.resizeTo(680,550);
		</SCRIPT>

	</BODY>
</HTML>